package com.jyw.business.obstacles.domain.dto.web;

import com.jyw.business.obstacles.domain.ObsOrderAssist;
import com.jyw.common.utils.DateUtils;
import com.jyw.common.utils.SecurityUtils;
import com.jyw.system.domain.vo.SimpleFileVo;
import com.jyw.system.utils.FileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author 沈峻
 * @ClassName AssistOrderDto
 * @Description 协作工单请求实体
 * @Date 2023/8/14 15:36
 **/
@Data
@ApiModel("协作工单请求实体")
public class AssistOrderDto extends BaseOrderDto{

    @ApiModelProperty("协作说明")
    private String assistRemark;

    @ApiModelProperty("公共附件")
    private List<SimpleFileVo> assistEnclosure;

    @ApiModelProperty("协作集合")
    private List<AssistOrderSubDto> assistList;


    public ObsOrderAssist buildAssist(String assistOrderNum){
        ObsOrderAssist assist = new ObsOrderAssist();
        assist.setAssistRemark(getAssistRemark());
        assist.setAssistEnclosureId(FileUtils.fileToId(getAssistEnclosure()));
        assist.setOrderNum(getOrderNum());
        assist.setAssistOrderNum(assistOrderNum);
        assist.setCreateTime(DateUtils.getNowDate());
        assist.setCreateUser(SecurityUtils.getUserId());
        return assist;
    }
}
